Add return type hints to all functions in main source code#1363
Add return type hints to all functions in main source code#1363xxiaoxiong wants to merge 3 commits into
Conversation
- Added -> None return type hint to property_set_duration function - Added -> None return type hint to property_del_duration function Contributes to collective#938 (Add type hints)
Documentation build overview
14 files changed ·
|
- Added -> None to use_pytz() in timezone/__init__.py - Added -> None to use_zoneinfo() in timezone/__init__.py - Added -> None to main() in cli.py - Added -> None to rfc_7953_end_property setter in attr.py - Added -> None to rfc_7953_end_property deleter in attr.py All functions have no return statements, so return type is None. Contributes to collective#938 (Add type hints)
- Added -> property to timezone_datetime_property() in attr.py - Added -> property to multi_string_property() in attr.py - Added -> str to unescape_backslash() in parser/property.py - Added -> Callable | property to single_string_parameter() in parser/parameter.py - Added -> tuple[type[_tzicalvtz], tuple] to pickle_tzicalvtz() in timezone/zoneinfo.py - Added -> tuple[functools.partial, tuple] to pickle_rrule_with_cache() in timezone/zoneinfo.py - Added -> tuple[type[unpickle_rruleset_with_cache], tuple] to pickle_rruleset_with_cache() in timezone/zoneinfo.py - Added -> rruleset to unpickle_rruleset_with_cache() in timezone/zoneinfo.py - Added -> None to main() in fuzzing/ical_fuzzer.py This completes all missing return type hints in the main source code. Contributes to collective#938 (Add type hints)
|
@xxiaoxiong would you please:
For details, see https://icalendar.readthedocs.io/en/stable/contribute/index.html and https://icalendar.readthedocs.io/en/stable/contribute/development.html. All of your other PRs might need the same treatment. Thank you! |
|
|
||
|
|
||
| def pickle_rrule_with_cache(self: rrule): | ||
| def pickle_rrule_with_cache(self: rrule) -> tuple[functools.partial, tuple]: |
There was a problem hiding this comment.
Please use a more usefull type than functools.partial and tuple.
|
|
||
|
|
||
| def pickle_rruleset_with_cache(rs: rruleset): | ||
| def pickle_rruleset_with_cache(rs: rruleset) -> tuple[type[unpickle_rruleset_with_cache], tuple]: |
There was a problem hiding this comment.
Please use a more usefull type than tuple.
|
@xxiaoxiong thank you for opening this PR. Because you haven't responded to the reviews and CI failures, I'm closing all of your PRs to let other contributors know that they are free to work on it. You're welcome to address our comments, resolve the matters, and reopen your pull request at any time, specifically to address the question of AI usage and add a change log, per Contribute. Thank you! |
This PR adds return type hints to all 16 functions that were missing them in the main source code (excluding tests).
Changes
Commit 1: Duration property functions (2 functions)
property_set_duration()→Noneproperty_del_duration()→NoneCommit 2: Timezone and CLI functions (5 functions)
use_pytz()→Noneuse_zoneinfo()→Nonemain()(cli.py) →Nonerfc_7953_end_propertysetter →Nonerfc_7953_end_propertydeleter →NoneCommit 3: Property factories, parsers, and pickle functions (9 functions)
timezone_datetime_property()→propertymulti_string_property()→propertyunescape_backslash()→strsingle_string_parameter()→Callable | propertypickle_tzicalvtz()→tuple[type[_tzicalvtz], tuple]pickle_rrule_with_cache()→tuple[functools.partial, tuple]pickle_rruleset_with_cache()→tuple[type[unpickle_rruleset_with_cache], tuple]unpickle_rruleset_with_cache()→rrulesetmain()(fuzzing) →NoneTesting
Impact
This completes the type hint coverage for all public functions in the main source code, making the codebase more maintainable and IDE-friendly.
Contributes to #938 (Add type hints)